﻿using DataWorks_Sqlite.MappingClass;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataWorks_Sqlite
{
    public class MyDbContext:DbContext
    {
       
        public DbSet<dw_props_admin>? dw_props_admin { get; set; }
        public DbSet<dw_props_clean>? dw_props_clean { get; set; }
        public DbSet<dw_props_datapredict>? dw_props_datapredict { get; set; }
        public DbSet<dw_props_convertcsvi>? dw_props_convertcsvi { get; set; }
        public DbSet<dw_props_linearconvert>? dw_props_linearconvert { get; set; }
        public DbSet<dw_props_spikeremove>? dw_props_spikeremove { get; set; }
        public DbSet<dw_props_halfhourcombine>? dw_props_halfhourcombine { get; set; }
        public DbSet<dw_props_txtcombine>? dw_props_txtcombine { get; set; }
        public DbSet<dw_props_mileagecombine>? dw_props_mileagecombine { get; set; }
        public DbSet<dw_props_user_mileageimport>? dw_props_user_mileageimport { get; set; }
        public DbSet<dw_props_user_halfhourimport>? dw_props_user_halfhourimport { get; set; }
        public DbSet<dw_props_mileagecalculation>? dw_props_mileagecalculation { get; set; }
        public DbSet<dw_sysauthority>? dw_sysauthority { get; set; }
        public DbSet<dw_systemversion>? dw_systemversion { get; set; }
        public DbSet<dw_props_datapredict_lstm>? dw_props_datapredict_lstm { get; set; }
        public DbSet<dw_props_dbcmessage>? dw_Props_Dbcmessages { get; set; }
        public MyDbContext(DbContextOptions<MyDbContext> options)
           : base(options)
        {
        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            optionsBuilder.UseSqlite("Data Source=dataworks_sqlite.db");
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            //从当前程序集加载所有的IEntityTypeConfiguration
            modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
        }
    }
}
